package com.partner.service;

import java.util.List;

import com.partner.dao.GroupDao;
import com.partner.domain.GroupUser;
import com.partner.domain.UserAndGroup;

/**
 * 关于群组的services
 * @author Jinshuan
 *
 */
public class GroupService {
	GroupDao groupDao = new GroupDao();
	//查询用户所有的群
		public List<UserAndGroup> selectUserBelongGroup(String userId){
			return groupDao.selectUserBelongGroup(userId);
		}
		//创建群
		public boolean createGroup(String groupName,String userid,String photo,String qunzhu,String nickname){
			//先将目前的最大的groupid给查到
			return groupDao.createGroup(groupName, userid, photo, qunzhu, nickname);
		}
		//得到群内所有用户
		//得到群内所有用户
		public List<GroupUser> getGroupUser(String groupId,String phone){
			return groupDao.getGroupUser(groupId,phone);
		}
		
		//邀请好友加入群里.这时是往好友表里插入数据（这里是投机取巧）,如果是邀请加入群里，就将friend表中的对应数据的state设置为6
		public boolean yaoqingFriend(String from,String[] tos,String groupId){
			return groupDao.yaoqingFriend(from, tos, groupId);
			
		}
		//明确拒绝加入对应的群,就是在自己服务器上删掉
		public boolean delineYaoqingTongZhi(String from_who,String to_who,String groupId){
			return groupDao.delineYaoqingTongZhi(from_who,to_who,groupId);
		}
		//同意加入群
		public boolean argeeIntoGroup(String userId, String groupId, String groupName,String photo,String qunzhu,String nickname,String from_who){
			return groupDao.argeeIntoGroup(userId, groupId, groupName, photo, qunzhu, nickname, from_who);
		}
}
